package entities;





import java.awt.Graphics;

public class Boundary implements Drawable{
    private int x;
    private int y;
    private int width; 
    private int height;
    
    public Boundary(int width, int height){
        x = 0;
        y = 0;
        this.width = width;
        this.height = height;
    }

    @Override
    public void render(Graphics g) {
        g.drawRect(x, y, width, height);
    }

    @Override
    public void add(Drawable d) {
    }

    @Override
    public void remove(Drawable d) {
    }

    @Override
    public Drawable getChild(int i) {
        return null;
    }

    @Override
    public Drawable colision(Drawable d) {
        Ball b = (Ball) d;
        if (b.getCoordenadaX() + 2 * b.getRadio() >= width || b.getCoordenadaX() < 0) b.setVelocidadX(b.getVelocidadX() * -1);
        if (b.getCoordenadaY() + 2 * b.getRadio() >= height || b.getCoordenadaY() < 0) b.setVelocidadY(b.getVelocidadY() * -1);
        return null;
    }
    
}
